export function request(url, methods="POST", data) {
    let baseUrl = "";

    if (process.env.NODE_ENV === 'development') {
        // 开发环境
        console.log("开发环境")
        
        baseUrl="https://3y43891q16.zicp.fun"
    } else if (process.env.NODE_ENV === 'production') {
        // 生产环境
        baseUrl="https://3y43891q16.zicp.fun"
    }
    return new Promise((resolve, reject) => {
        console.log(baseUrl);
        let userInfo=uni.getStorageSync("userinfo")
        uni.request({
            url: baseUrl+url,
            method:methods,
            data: data,
            header: {
                Authorization:"Bearer - " + userInfo.token
            },
            success: function (res) {
                resolve(res)
            },
			fail: (error) => {
				resolve(error)
			}
        })
    })

}

